Welcome to OptiPerl!

If you just downloaded OptiPerl, or you are new to CGI programming, read the following for a quick start.

 

Setting Up

To use OptiPerl you need a distribution of Perl for Windows. We recommend using IndigoPerl Distribution, which is free, easy to install and also contains the apache web server if you ever need it. You can also use the ActiveState distribution. If you first loaded OptiPerl and you had perl installed, then OptiPerl should have already found it. If you do not have perl installed yet then:

1) Download perl: You will find the distribution we recommend on our FAQ page of OptiPerl:
http://www.xarka.com/optiperl/faq.html

2) If you downloaded IndigoPerl, unzip it in any directory and run the bat file included.
We recommend unzipping the files in c:\perl. If you use this folder, then step 3 and 5 below is not needed.

3) If OptiPerl has still not found perl, then open the Tools/Options dialog. Go to tab "Perl" and change to the location of perl.exe.

4) You are ready!




Basic Stuff

If you don't know much about how to use CGI scripts in your web page, here is a very brief introduction. There are many great sites on the internet for tutorials.

Make sure you have installed first perl as noted in Setting Up.

Let' s assume you want to create a web site with some forms. Do the following

1) Select "New html file" and enter the following.

<form action="cgi-bin/basic.cgi" method="GET"> 
Enter some text here: 
<input type="text" name="text" size=30>
<input type="submit"><p></form> 

This creates an input on your page for the user to enter text. Most Web-Editors allow you to create stuff like this automatically. Notice the GET method used here. When the user presses "Submit", the browser will call the URL:

http://127.0.0.1/cgi-bin/test.cgi?text=what_you_typed

Under the path you installed OptiPerl, you will find a folder "webroot" (like c:\program files\OptiPerl\webroot). Save your file there with the name "basic.html"

2) Select "New Script" and enter the following.

#!perl
print "Content-Type: text/html\n\n";
print "$ENV{'QUERY_STRING'}<br>";

Save in "webroot\cgi-bin" as basic.cgi.

Now time to run. Make sure that you have a check-mark on "Server/Internal Server Enabled" and the root path under "Server/Internal Server Root" is "c:\program files\OptiPerl\webroot" (or accordingly where you installed OptiPerl).
Also make sure "Server/Run with Server" is checked too.

Go back to your html document "basic.html" pressing the tab in the editor and press "F9" to run.
You should see the html document in the web browser. Enter something in the text box and press "Submit"

You should see the result in a dynamically created html page. That's the basics!
If you get an error, please make sure you read about "Setting Up".

3) Now to send this to an Internet server, you might need to change the first line (the location of perl on the web server). If your internet web server has cgi enabled with a cgi-bin directory contact your provider for what this line should be.

OptiPerl's Help

Included with OptiPerl are the following to help you:

 

Examples

Included with OptiPerl are some examples of CGI programming. Explore the webroot folder to see these examples (from the book "Official Guide to Programming with CGI.pm" by Lincoln D. Stein - John Wiley & Sons, Inc.).